﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ADL;

namespace CDIO.Controllers
{
    public class UserActionController : Controller
    {
        //
        // GET: /UserAction/

        /// <summary>
        /// 用户删除
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public ActionResult User_Delete(string _user_id)
        {
            ADL_user ad_us = new ADL_user();
            _user us = new _user();
            us._user_id = _user_id;
            if (ad_us.delete(us))
            {
                return Json(new { Result = true, Message = "删除成功" });
            }
            return Json(new { Result = true, Message = "删除失败" });
        }

        /// <summary>
        /// 用户添加
        /// </summary>
        /// <param name="_user_id"></param>
        /// <param name="_user_name"></param>
        /// <param name="_user_psw"></param>
        /// <param name="_user_phone"></param>
        /// <param name="_user_credit"></param>
        /// <param name="_user_level"></param>
        /// <returns></returns>
        public ActionResult User_Add(string _user_id, string _user_name, string _user_psw, string _user_phone, string _user_credit, string _user_level)
        {
             ADL_user ad_us = new ADL_user();
            _user us = new _user();
            us._user_id = _user_id;
            us._user_name = _user_name;
            us._user_psw = _user_psw;
            us._user_phone = _user_phone;
            us._user_credit = _user_credit;
            us._user_level = _user_level;
            if (ad_us.insert(us) != null)
            {
                return Json(new { Result = true, Message = "添加成功" });
            }
            return Json(new { Result = true, Message = "添加失败" });
        }

        /// <summary>
        /// 用户添加
        /// </summary>
        /// <param name="_user_id"></param>
        /// <param name="_user_name"></param>
        /// <param name="_user_psw"></param>
        /// <param name="_user_phone"></param>
        /// <param name="_user_credit"></param>
        /// <param name="_user_level"></param>
        /// <returns></returns>
        public ActionResult User_Change(string _user_id, string _user_name, string _user_psw, string _user_phone, string _user_credit, string _user_level)
        {
            ADL_user ad_us = new ADL_user();
            _user us = new _user();
            us._user_id = _user_id;
            us._user_name = _user_name;
            us._user_psw = _user_psw;
            us._user_phone = _user_phone;
            us._user_credit = _user_credit;
            us._user_level = _user_level;
            if (ad_us.update(us))
            {
                return Json(new { Result = true, Message = "修改成功" });
            }
            return Json(new { Result = true, Message = "修改失败" });
        }

         



    }
}
